unit opcoes;

interface

uses
    Windows, //LResources
    Registry, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls, ExtCtrls;

type
  TFOpcoes = class(TForm)
    Label1: TLabel;
    Playvel: TTrackBar;
    Button1: TButton;
    Label4: TLabel;
    cordofundo: TColorDialog;
    ECordofundo: TShape;
    ChekForcePink: TCheckBox;
    Label5: TLabel;
    Label6: TLabel;
    ChekPalLoad: TCheckBox;
    Button2: TButton;
    procedure PlayvelChange(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure ECordofundoMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    procedure ChekPalLoadClick(Sender: TObject);
    procedure ChekForcePinkClick(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FOpcoes: TFOpcoes;

implementation

uses sprites;

{$R *.DFM}

procedure TFOpcoes.PlayvelChange(Sender: TObject);
begin
  FormSprites.Trial.WriteString('SFF','PLAYVEL',inttostr(playvel.position));
  Playvel.Hint:=inttostr(playvel.position);
  formsprites.timerplay.interval:=playvel.position;
end;

procedure TFOpcoes.Button1Click(Sender: TObject);
var
  Reg:TRegistry;
begin

  Reg:=TRegistry.Create;
  try
    Reg.RootKey:=HKEY_CLASSES_ROOT;
    Reg.LazyWrite:=false;
    Reg.OpenKey('MugenSFF', true);
    Reg.WriteString('', 'Mugen Sprite File Format');
    Reg.CloseKey;
    Reg.OpenKey('MugenSFF\shell\open\command', true);
    Reg.WriteString('', ParamStr(0) + ' %1');
    Reg.CloseKey;
    Reg.OpenKey('MugenSFF\DefaultIcon', true);
    Reg.WriteString('', ParamStr(0) + ',1');
    Reg.CloseKey;
    Reg.OpenKey('.sff', true);
    Reg.WriteString('', 'MugenSFF');
    Reg.CloseKey;
  finally
    Reg.Free;
  end;
end;

procedure TFOpcoes.ECordofundoMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  if ( cordofundo.Execute ) then
  begin
    Formsprites.Scrollbox2.color:=cordofundo.color;
    Ecordofundo.Brush.Color:=cordofundo.color;
    Formsprites.Trial.WriteString('CORFUNDO','R',inttostr(GetRValue(ColorToRGB(cordofundo.color))));
    Formsprites.Trial.WriteString('CORFUNDO','G',inttostr(GetGValue(ColorToRGB(cordofundo.color))));
    Formsprites.Trial.WriteString('CORFUNDO','B',inttostr(GetBValue(ColorToRGB(cordofundo.color))));
  end;
end;

procedure TFOpcoes.ChekPalLoadClick(Sender: TObject);
begin
if ChekPalLoad.Checked=true then begin Formsprites.Trial.WriteString('SFF','PALLOAD','1'); end;
if ChekPalLoad.Checked=false then begin Formsprites.Trial.WriteString('SFF','PALLOAD','0'); end;
end;

procedure TFOpcoes.ChekForcePinkClick(Sender: TObject);
begin
if ChekForcePink.Checked=true then begin Formsprites.Trial.WriteString('SFF','PINKFORCE','1'); end;
if ChekForcePink.Checked=false then begin Formsprites.Trial.WriteString('SFF','PINKFORCE','0'); end;
end;

procedure TFOpcoes.Button2Click(Sender: TObject);
var Reg:TRegistry;
begin
Reg:=TRegistry.Create;
try
Reg.RootKey:=HKEY_CLASSES_ROOT;
Reg.LazyWrite:=false;
Reg.OpenKey('MugenACT', true);
Reg.WriteString('', 'Mugen Palette File');
Reg.CloseKey;
Reg.OpenKey('MugenACT\shell\open\command', true);
Reg.WriteString('', ParamStr(0) + ' %1');
Reg.CloseKey;
Reg.OpenKey('MugenACT\DefaultIcon', true);
Reg.WriteString('', ParamStr(0) + ',3');
Reg.CloseKey;
Reg.OpenKey('.act', true);
Reg.WriteString('', 'MugenACT');
Reg.CloseKey;
finally
Reg.Free;
end;
end;


//initialization
//  {$I opcoes.lrs}

end.
